package cn.com.vrv.mapper;

import java.util.Date;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import cn.com.vrv.common.TaskEnum;
import cn.com.vrv.entity.RecognitionTask;

/**
 * <一句话功能简述>
 * 
 * @author 赵炎
 * @version [V1.00, 2017年11月21日]
 * @see [相关类/方法]
 * @since V1.00
 */
public interface RecognitionTaskMapper extends JpaRepository<RecognitionTask, Long>,
													JpaSpecificationExecutor<RecognitionTask> 
{

	Page<RecognitionTask> findAll(Pageable pageable);
	
	//Page<RecognitionTask> findBookCriteria(Integer page,Integer size,RecognitionTask task);  
		
	@Query("select t from RecognitionTask t where t.taskId = ?1")
	RecognitionTask findByTaskId(Long taskId);
	@Transactional
	@Modifying
	@Query("delete from RecognitionTask t where t.taskId = ?1")
	void deleteByTaskId(Long taskId);
	
	@Transactional
	@Modifying
	@Query("update RecognitionTask t set t.fileName =?1,t.updateTime =?2,t.taskType =?3, t.status =?4 where t.taskId =?5")
	void updateByTaskId(String fileName,Date updateTime,String taskType,TaskEnum  status,Long taskId);
}
